import java.awt.*;
import java.awt.event.InputEvent;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
        GetMouseXY();
        try {
            Robot robot = new Robot();
            robot.delay(1000);
            Point point = MouseInfo.getPointerInfo().getLocation();
            robot.mouseMove(400,200);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.delay(1000);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
        } catch (AWTException e) {
            throw new RuntimeException(e);
        }
    }
    private static void GetMouseXY(){
        int x = 0;
        int y = 0;
        while(true){
            PointerInfo pinfo = MouseInfo.getPointerInfo();
            int mx = pinfo.getLocation().x;
            int my = pinfo.getLocation().y;
            if (x!=mx||y!=my){
                x=mx;
                y=my;
                System.out.println("x:"+mx+",y:"+my);
            }
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                System.out.println(e.getMessage());
            }
        }
    }
}